﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using H2.Streams;

namespace Mystery
{
    public class BoundingBox
    {
        public float MinX = float.MaxValue;
        public float MinY = float.MaxValue;
        public float MinZ = float.MaxValue;

        public float MaxX = float.MinValue;
        public float MaxY = float.MinValue;
        public float MaxZ = float.MinValue;

        public void Add(float x, float y, float z)
        {
            if (x < MinX) MinX = x;
            if (x > MaxX) MaxX = x;

            if (y < MinY) MinY = y;
            if (y > MaxY) MaxY = y;

            if (z < MinZ) MinZ = z;
            if (z > MaxZ) MaxZ = z;
        }

        public bool Contains(float x, float y, float z)
        {
            if (x < MinX || x > MaxX) return false;
            if (y < MinY || y > MaxY) return false;
            if (z < MinZ || z > MaxZ) return false;
            return true;
        }
    }
}
